package com.tgu.home_action.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Timestamp;
import java.util.Date;

@Data
public class Log {
    private Integer userId;

    private String role;
    /**
     * 业务ID
     */
    private Integer actionId;
    /**
     * 操作类型
     */
    private Integer actionType;
    /**
     * 操作结果
     */
    private String result;
    /**
     * 备注
     */
    private String comment;
    /**
     * IP
     */
    private String ip;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp time;

    public Log(Integer userId, String role, Integer actionId, Integer actionType, String result, String comment, String ip) {
        this.userId = userId;
        this.role = role;
        this.actionId = actionId;
        this.actionType = actionType;
        this.result = result;
        this.comment = comment;
        this.ip = ip;
        this.time = new Timestamp(new Date().getTime());
    }

    public Log() {

    }
}
